Skip to content

Preserve chained assignments before fused local stores - #1

Closed
EiNSTeiN- wants to merge 4 commits into
ejfkdev:mainfrom
EiNSTeiN-:fix/fused-store-assignment-chains
Closed

EiNSTeiN- wants to merge 4 commits into
ejfkdev:mainfrom
EiNSTeiN-:fix/fused-store-assignment-chains

Conversation

@EiNSTeiN-

@EiNSTeiN- EiNSTeiN- commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

I am opening this PR to fix chained assignments followed by fused local stores in pycdc. The code below fails to decompile correctly from Python 3.13 and 3.14 bytecode and succeeds with this change:

def select(read):
    a = b = c = d = read()
    return a, b, c, d

Variations include three through six targets and a constant None instead of read(). A genuine chain evaluates its right-hand side once and gives every target that same object. The parser already understands chained assignment, but fails to recognize a following STORE_FAST_STORE_FAST as a store; it can consequently classify a COPY sequence as an expression operation and lose the chain. Adding that opcode to the existing store predicate is the entire production change, in the COPY/assignment lookahead.

STORE_FAST_STORE_FAST was introduced in Python 3.13, rather than 3.14, as recorded in the Python opcode documentation.

@ejfkdev ejfkdev closed this in #28 Oct 23, 2026
ejfkdev added a commit that referenced this pull request Oct 23, 2026
Integrate community PRs #1–#26: 100% real-world corpus recompiles
dagezi11 pushed a commit to dagezi11/pycdc that referenced this pull request Nov 18, 2026
Merges the 26 targeted decompiler fixes from @EiNSTeiN- (3.11-3.14
bytecode families) on top of main. Three textual conflicts were resolved
by keeping both sides: PR ejfkdev#6 stacks on ejfkdev#5, all PRs append tests at the
same point in tests/integration.rs, and ejfkdev#4/ejfkdev#5/ejfkdev#6/ejfkdev#24 append test-module
declarations at the end of decompiler.rs.

Verification with the standard release profile:
- real-world corpus 6411/6411 recompile (was 6408/6411)
- stdlib corpus 528/528 semantic pass (520 + 8 new padded fixtures)
- behavior matrix: all cases pass on 3.9-3.14 (56 failures remain on
  3.15, all pre-existing; main had 61 there)
- cargo test: 37 integration + 8 + 27 unit tests pass

README/CHANGELOG/LIMITATIONS updated (100% real-world, AST-equal 2493).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant